package echo

import (
	"context"
	"github.com/gin-gonic/gin"
	"wx-uniapp-go/third_party/cdslog"
	"wx-uniapp-go/utils"
)

func TraceCtx(c *gin.Context) context.Context {
	//ctx := cdslog.TraceCtx(context.Background(), c.GetString(cdslog.REQID))
	//trace.SpanFromContext()
	ctx := c.Request.Context()
	//ctx := pluginsgin.TraceCtx(c)
	traceId := utils.GetTraceIdFromGin(c)
	ctx = context.WithValue(ctx, cdslog.LOGTRACEIDKEY, traceId) // 记录trace id
	return ctx
}
